#ifndef MNTCOMPUTER_H
#define MNTCOMPUTER_H

using namespace std;

#include <common/meshmodel.h>
#include <common/interfaces.h>
#if VERSION == 131
#include <vcg/complex/algorithms/create/platonic.h>
#elif VERSION == 133
#include <vcg/complex/algorithms/create/platonic.h>
#else
#include <vcg/complex/trimesh/create/platonic.h>
#endif

class mntComputer
{

public:

    mntComputer();
    std::vector<CVertexO*> GetMnt(MeshDocument &md,RichParameterSet &par, vcg::CallBackPos *cb);

private:

    /* Variables for dividing the mesh */
    vcg::GridStaticPtr<CVertexO,float> grid;
    vcg::GridStaticPtr<CVertexO,float> gridmin;

    /* Input mesh */
    MeshModel* mesh;
    /* Minima vertices mesh */
    MeshModel* meshMinima;

    void getPtsMin(vcg::GridStaticPtr<CVertexO,float>& _grid);
    int filterCloudOnZ(MeshModel* mInput,RichParameterSet &par, vcg::CallBackPos *cb);
    void buildPoissonSurface(MeshModel& pm,MeshModel &m,RichParameterSet & par, vcg::CallBackPos *cb);
    int cleanMeshOnQ(MeshModel* mesh,float threshold);

    MeshModel* buildFlatMesh (MeshDocument &md, MeshModel* inputMesh,RichParameterSet & par);
    MeshModel* projectOnPoisson(MeshDocument &md,MeshModel* poisson,MeshModel* inputMesh, float zmin, vcg::CallBackPos *cb);

    MeshModel* FixTheProj(MeshDocument &md, vcg::GridStaticPtr<CVertexO,float> gridMnt, vcg::GridStaticPtr<CVertexO,float>gridPoisson,RichParameterSet & par);
    void buildBallPivotingSurface(MeshModel* m,RichParameterSet & par, vcg::CallBackPos *cb);

};

#endif
